package com.fr.report.io.xml;

import com.fr.report.web.ui.FieldEditor;
import com.fr.report.web.ui.TextEditor;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

public class SynchronizedNameWidget
{
  private static final Hashtable threadNameWidgetMap = new Hashtable();
  private static final HashMap threadDefaultValueMpa = new HashMap();

  public static void put(String paramString, FieldEditor paramFieldEditor)
  {
    Object localObject = (Map)threadNameWidgetMap.get(Thread.currentThread());
    if (localObject == null)
    {
      localObject = new HashMap();
      threadNameWidgetMap.put(Thread.currentThread(), localObject);
    }
    ((Map)localObject).put(paramString, paramFieldEditor);
  }

  public static FieldEditor get(String paramString)
  {
    Map localMap = (Map)threadNameWidgetMap.get(Thread.currentThread());
    if (localMap != null)
    {
      Object localObject = (FieldEditor)localMap.get(paramString);
      if (localObject == null)
        localObject = new TextEditor();
      ((FieldEditor)localObject).setFieldName(paramString);
      return localObject;
    }
    return ((FieldEditor)null);
  }

  public static void put(String paramString, Object paramObject)
  {
    Object localObject = (Map)threadDefaultValueMpa.get(Thread.currentThread());
    if (localObject == null)
    {
      localObject = new HashMap();
      threadDefaultValueMpa.put(Thread.currentThread(), localObject);
    }
    ((Map)localObject).put(paramString, paramObject);
  }

  public static Object getDefaultValue(String paramString)
  {
    Map localMap = (Map)threadDefaultValueMpa.get(Thread.currentThread());
    if (localMap != null)
      return localMap.get(paramString);
    return null;
  }

  public static void removeCurrent()
  {
    threadNameWidgetMap.remove(Thread.currentThread());
    threadDefaultValueMpa.remove(Thread.currentThread());
  }
}